package VN.EDU.IMIC.PROJECTLEADER.NGUYENVANDOAN.SWINGDEMO.Models;

import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Types;

import VN.EDU.IMIC.PROJECTLEADER.NGUYENVANDOAN.SWINGDEMO.Entity.UserEntity;

import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Types;

import VN.EDU.IMIC.DEVELOPER.LETRONGKHANH.JDBC_DEMO.CallableStament_demo03;
import VN.EDU.IMIC.DEVELOPER.LETRONGKHANH.SWINGDEMO.User;

public class LoginModels {
	private Connection m_objConnection;
	private CallableStatement m_objCmst;

	public LoginModels(Connection objConnection) {
		m_objConnection = objConnection;
	}

	public boolean CheckElement(UserEntity objUser) throws SQLException {
		try {
			m_objCmst = m_objConnection
					.prepareCall("{? = call Y2015JC72USER(?,?)}");
			m_objCmst.registerOutParameter(1, Types.BIT);
			m_objCmst.setString("UserName",objUser.getUserName());
			m_objCmst.setString("PassWord",objUser.getPassWord());
			m_objCmst.execute();
		} catch (Exception ex) {
			throw ex;
		}
		return m_objCmst.getBoolean(1);
	}
}